package main

import (
	"fmt"
	"math/rand"
	"time"
)

func main() {

	ch := make(chan int, 10)
	go conumer(ch)
	go producer(ch)

	time.Sleep(time.Second * 10)
	fmt.Println("main process exit!")

}

func conumer(ch <-chan int) {
	for {
		i := <-ch
		fmt.Println("consumer:", i)
	}

}

func producer(ch chan<- int) {
	for {
		ch <- rand.Intn(888888)

	}

}
